package com.example.jdshopdeail.fragment;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.jdshopdeail.R;
import com.example.jdshopdeail.adapter.CommentListAdapter;
import com.example.jdshopdeail.base.BaseFragment;
import com.example.jdshopdeail.bean.CommentListBean;
import com.example.jdshopdeail.view.DividerDecoration;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * @author: njb
 * @date: 2020/3/24 0024 10:48
 * @desc: 商品评论列表
 */
public class FMCommonList extends BaseFragment {
    private CommentListAdapter commentListAdapter;
    @BindView(R.id.rv_common_list)
    RecyclerView recyclerView;
    private List<CommentListBean> mList;

    @Override
    protected void loadData() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.fm_common_list;
    }

    @Override
    protected void initView() {
        mList = new ArrayList<>();
        List<String> list = new ArrayList<>();
        list.add("http://ww4.sinaimg.cn/large/006uZZy8jw1faic259ohaj30ci08c74r.jpg");
        list.add("http://ww4.sinaimg.cn/large/006uZZy8jw1faic2b16zuj30ci08cwf4.jpg");
        list.add("http://ww4.sinaimg.cn/large/006uZZy8jw1faic2e7vsaj30ci08cglz.jpg");

        for(int i=0;i<10;i++){
            CommentListBean commentListBean = new CommentListBean();
            commentListBean.setAddress("北京市昌平区立水桥");
            commentListBean.setContent("鞋子形状做的比较讨我喜欢，做工不错,鞋子形状做的比较讨我喜欢，做工不错,鞋子形状做的比较讨我喜欢鞋子形状做的比较讨我喜欢鞋子形状做的比较讨我喜欢");
            mList.add(commentListBean);
        }
        commentListAdapter = new CommentListAdapter(mList);
        recyclerView.setLayoutManager(new LinearLayoutManager(context));
        recyclerView.addItemDecoration(new DividerDecoration(context.getResources().getColor(R.color.ce7e7e7), 1));
        recyclerView.setAdapter(commentListAdapter);
    }

    @Override
    protected void addListener() {

    }
}
